people = {'Tom': 1111, 'Jerry':2222, 'Lucy': 3333}
passwd = input("请输入pin码：")

def getFruit(fruit):
    with open('fruits.txt') as f:
        '''
        for line in f:
            # if fruit == line[0:-1]:
            if fruit == line.strip():
                return '%s存在，吃吧' % fruit
        '''
        # fruits = f.read()
        # fruits = fruits.splitlines()
        fruits = f.read().splitlines()
        if fruit in fruits:
            return '%s存在，吃吧' % fruit
    return '输入的 %s有误，请重试' % fruit

if int(passwd) in people.values():
    f = input('请输入一种水果：')
    print(getFruit(f))
else:
    print('只有以下用户能够使用:')
    for key in people:
        print(key, end=' ')
print()
